package com.itqian.utils;

import com.auth0.jwt.interfaces.DecodedJWT;
import com.itqian.common.utils.JWTUtils;

/**
 * @author shishuqian
 * date 2022/3/28
 * time 18:27
 **/
public class TokenUtils {

    public static Integer getUserId(String token){
        DecodedJWT tokenInfo = JWTUtils.getTokenInfo(token);
        String string = tokenInfo.getClaim("userId").asString();
        return Integer.parseInt(string);
    }

    public static Integer getStoreId(String token){
        DecodedJWT tokenInfo = JWTUtils.getTokenInfo(token);
        String string = tokenInfo.getClaim("storeId").asString();
        return Integer.parseInt(string);
    }
}
